import java.io.File;
import java.io.IOException;

import Sys_Module.List_Main;
import Sys_Module.Log_Module;
import Sys_Module.Server_Network;

public class Main_Server {
    private static String Log_getlujin() {// 获取路径程序
        File directory = new File("");// 设定为当前文件夹
        String text = "";
        try {
            // System.out.println(directory.getCanonicalPath());// 获取标准的路径
            text = directory.getAbsolutePath();// 获取绝对路径
        } catch (Exception e) {
        }
        return text + "\\log\\";
    }

    public static void main(String args[]) throws InterruptedException, IOException {

        Log_Module Log_SYS = new Log_Module(Log_getlujin() + "Main_Server"); // 初始化日志对象
        Log_SYS.Write_log("Server Main", "主程序启动");

        List_Main lm = new List_Main(Log_SYS);// 初始化队列主程序 并传递日志对象进去
        lm.LMDisplay();

        Server_Network SM = new Server_Network("192.168.1.109", 48002, lm, Log_SYS); // 取号机(xiongxuan)
        Server_Network SM2 = new Server_Network("192.168.1.233", 48003, lm, Log_SYS);// 窗口机(jieqi)
        Server_Network SM3 = new Server_Network("192.168.1.151", 48001, lm, Log_SYS);// 叫号机(yutao)
        Thread SM_Thread = new Thread(SM);
        Thread SM2_Thread = new Thread(SM2);
        Thread SM3_Thread = new Thread(SM3);
        SM3_Thread.start();
        lm.SETSN48003(SM2);
        SM_Thread.start();
        // lm.init();
        // Thread.sleep(1000);
        SM2_Thread.start();
        lm.Working(SM3);
        lm.SETSN48002(SM);
        // test.JQ.XX
    }
}
